package com.orcamento.entity.report.subreport;

import com.orcamento.util.MathUtil;
import com.orcamento.util.Money;

public class EventSpent implements Comparable<EventSpent> {

	private String name;
	private Money total;
	private String percentage;
	
	public EventSpent(String name, Money total) {
		this.name = name;
		this.total = total;
	}
	
	public String getName() {
		return name;
	}
	public Money getTotal() {
		return total;
	}
	public String getPercentage() {
		return percentage;
	}
	public void setPercentage(Money totalValue) {
		this.percentage = MathUtil.getMoneyPercentage(total, totalValue);
	}

	@Override
	public int compareTo(EventSpent other) {
		if(other == null) {
			return 1;
		}
		if(total.equals(other.total)) {
			return 0;
		}
		return total.greaterThan(other.total) ? 1 : -1 ;
	}
	

}
